package org.zs;

import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidPooledConnection;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class DruidDemo {
    public static void main(String[] args) throws SQLException {
        DruidDataSource druidDataSource = new DruidDataSource();
        druidDataSource.setDriverClassName("com.mysql.jdbc.Driver");
        druidDataSource.setUrl("jdbc:mysql://localhost:3306/delivery_system");
        druidDataSource.setUsername("root");
        druidDataSource.setPassword("123456");

        DruidPooledConnection connection = druidDataSource.getConnection();
        String sql = "select * from sys_user;";
        PreparedStatement preparedStatement = connection.prepareStatement(sql);
//        preparedStatement.setObject(1, "1");
        ResultSet resultSet = preparedStatement.executeQuery();
        preparedStatement.close();
        connection.close();


    }
}
